package com.health.demo.common.vo;

import lombok.*;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Search {

    public final static int DEFAULT_CURRENT_PAGE = 1;
    public final static int DEFAULT_PAGE_SIZE = 5;

    //当前页码
    private Integer currentPage;
    // 当前页显示的页数（长度）
    private Integer pageSize;
    // 查询关键字（模糊查询的内容）
    private String keyWord;
    // 按什么排序
    private String sort;
    // 排序顺序
    private String direction;

    public void initSearch() {
        if (this != null) {
            this.setCurrentPage(this.getCurrentPage() == 0 ? DEFAULT_CURRENT_PAGE : this.getCurrentPage());
            this.setPageSize(this.getPageSize() == 0 ? DEFAULT_PAGE_SIZE : this.getPageSize());
        }
    }
}
